import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/widget/custom_list_title.dart';
import 'package:boss/ui/widget/image/base_image.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:boss/models/material.dart' as material;

class ClassificationDetailMaterialItem extends StatelessWidget {
  final material.Material data;
  final VoidCallback onDelete;

  const ClassificationDetailMaterialItem({
    Key key,
    @required this.data,
    this.onDelete,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return CustomListTitle(
      title: Row(
        children: <Widget>[
          Text(
            data.meterialName,
            style: TextStyleConstant().normal_1_28,
          ),
          Container(
            margin: EdgeInsets.only(
              left: 36.w,
            ),
            child: Text(
              AmountUtil.price2String(data.meterialPrice),
              style: TextStyleConstant().normal_1_28,
            ),
          ),
        ],
      ),
      trailing: GestureDetector(
        onTap: onDelete,
        behavior: HitTestBehavior.translucent,
        child: BaseImage(
          'assets/image/delete_icon.png',
          width: 44.w,
          height: 44.w,
        ),
      ),
    );
  }
}
